#ifndef ORDER_H
#define ORDER_H

#include <QWidget>
#include <QDesktopWidget>

#include "dbconnection.h"
#include "customer.h"

namespace Ui {
    class Order;
}

class Order : public QWidget
{
    Q_OBJECT

public:
    explicit Order(QWidget *parent = 0);
    ~Order();

    void getOrders(QSqlQueryModel* model);
    void setOrder(QString id);
    void setCustomer(QStringList customerData);
    void deleteOrder(QString id);

signals:
    void updateOrders();

private:
    Ui::Order *ui;

    static const QString QUERY_ALL_ORDERS;
    static const QString QUERY_FULL_ORDER;

    QString _currentOrderId;
    QString _currentCustomerId;

    void centerOnScreen();
    void clearForm();
    void loadOrder();

private slots:
    void accept();
    void close();
};

#endif // ORDER_H
